<?php
abstract class AdnLibraryRow extends Zend_Db_Table_Row_Abstract
{
    public function __construct(array $input = array())
    {
        $class = explode(' ', get_class($this));
        $this->_tableClass = 'Table' . array_pop($class) . 's';
        parent::__construct($input);
        $cols  = $this->_table->info(Zend_Db_Table_Abstract::COLS);
        if (!isset($input['data'])) 
		{
            $input['data'] = array_combine($cols, array_pad(array(),count($cols),null));
        }
        $this->_data = $input['data'];
    }
	
	 public function getForm($form = null)
    {
        $formObject = $this->getTable()->getForm($form);
        if ($this->_data[$this->_primary[1]] != null && $form == null) 
		{
            $formObject->populate($this->_data);
        }
        return $formObject;
    }
    
    public function save()
    {
        $form = $this->getForm();
        if (!$form->isValid($this->_data)) 
		{
            return false;
        }
        return parent::save();
    }
}

?>